perm filename DO.RPH[UP,DOC]11 blob sn#437070 filedate 1979-04-30 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00004 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	DO
C00007 00003	DO PROGRAM EXTENSIONS	-- MLB 1 May 79
C00015 00004	EXAMPLES OF EXTENDED DO
C00017 ENDMK
C⊗;
DO

	[Discussion of the new DO extensions is on pages 3 and 4].

	THE DO PROGRAM READS ANY STANDARD TEXT FILE AND PUTS THE
CHARACTERS FROM THE FILE INTO YOUR TTY INPUT BUFFER. THEN THE PROGRAM
EXITS AND THE MONITOR READS THE CHARACTERS AND DOES THE REST.
DO IGNORES LINE NUMBERS AND THE TAB FOLLOWING THEM.

	DO ALSO RECOGNIZES THE FOLLOWING SPECIAL PURPOSE CHARACTERS
AND MAKES THE FOLLOWING CONVERSIONS:

	<CR>	IGNORED.

	<LF>	IGNORED.

	↔	INSERT A <CR> AT THIS POINT(THE MONITOR
		USUALLY ECHO'S THIS AS <CR><LF>).

	↓	INSERT AN <LF> AT THIS POINT.

	≠	INSERT AN ALTMODE.

	λ	INSERT A DELAYED ↑C.

	α	ADD CTRL BIT TO THE NEXT CONVERTED CHARACTER.

	<VT>	ADD CTRL BIT TO THE NEXT CONVERTED CHARACTER.

	β	ADD META BIT TO THE NEXT CONVERTED CHARACTER.

	<FF>	ADD META BIT TO THE NEXT CONVERTED CHARACTER.

	⊗	<ESCAPE>	(CIRCLE X)

	⊗-	<BREAK>		(CIRCLE X, MINUS)

	?A	WHERE A IS ANY CHARACTER OTHER THAN <CR> OR <LF>.
		IF THIS IS THE FIRST OCCURENCE OF "A" THEN THE
		PROGRAM PRINTS "?A	" AND INSERTS THE TEXT YOU
		TYPE AT THIS POINT IN THE FILE. (THE CHARACTERS ARE
		THEN CONVERTED .)

	≡	QUOTE THE NEXT CHARACTER.(PASS IT WITH NO CONVERSION.)

        |        separates different DO functions (see below)

	?        takes  the next  character  (other than  RETURN or  LINE)  as a
		 variable name.  Suppose the character is A (i.e., ?A).  If this
		 is  the  first occurrence  of  ?A  in the  file,  DO  types out
		 "A=     " and  waits for you  to type in  a text  string ending
		 with RETURN.  This  string is substituted for  every occurrence
		 of ?A in the file.

		NOTE: (1 MAY 79)  The command ?\ has been usurped.  It now is used
		to enable the new extensions to DO.  For details see further on in
		this file.

To allow more than  one DO function to be  stored in the same  file (because
small  files are  inefficient in  using disk  space), the  vertical  bar (|)
character can be used as a separator.  The command

DO DOFILE(3)

will DO the commands between the second and third | characters in the file.

RUNNING DO:

	IF YOU SAY "R DO" YOU WILL GET A STAR. YOU THEN TYPE THE NAME
OF THE FILE YOU WISH TO "DO". 

	IF YOU  SAY "DO <FILENAME>" IT WRITES  A QQSVCM.RPG SUCH THAT
IF YOU SAY "G" TO THE EDITOR  YOU GET THE SAME DO OPERATION. IT  ALSO
WRITES A QQDO.RPG SUCH THAT IF YOU SAY "DO" WITH NO FILENAME IT TRIES
TO  FIND THE LAST ONE YOU  "DID".  SAYING "DO  FOO" WILL FIRST TRY TO
`DO' FILE "FOO.DO", THEN TRY "FOO" IF "FOO.DO" DOESN'T EXIST.  SAYING
"DO FOO." WILL DO FILE "FOO". 

Nesting do files doesn't work, but chaining them at monitor level does.
This avoids the restriction on line length. [PAM-2/7/77]

Vbar documentation copied from moncom [PAM-7/10/78]

DO PROGRAM EXTENSIONS	-- MLB 1 May 79
This section documents some newly implemented extensions to the DO
program.  Some of these "features" may be flushed, new ones may be added,
others modified.  Since the DO program is inherently limited in its
usefulness some of these bells and whistles may be of fairly dubious
utility.  The next page provides some examples.


THE BRICK
To use the new DO features you must specify a special escape character.
Following the POX convention we will call this escape character the
"brick".  In the following, we will use the backslash character "\" as the
brick character in examples of the new features.  We will also use BNF
style angle brackets to enclose syntactic entities, for example, <char>
will be used to denote any character.

To specify a brick character use the sequence
	?\<char>
This makes the <char> the brick character.  For example, to specify
backslash as the brick character use
	?\\

Previously, ?\ would have been processed as a variable name command (cf
earlier DO documentation).  This sequence is no longer available for this
purpose.  This is the only (downwards) incompatibility with the old DO
program.


BRICK COMMAND SYNTAX
The brick character appears as the first character of all the new
commands.  Subsequent characters are scanned to determine the command and
to get any needed arguments, etc.  Then normal processing is resumed until
the brick character is encountered again.

If the command is denoted by a special keyword the keyword is delimited on
the right by a dot character "." and may be in upper and/or lower case
letters.


BRICK COMMAND DESCRIPTIONS
The following commands will be grouped in terms of related function.


SPECIAL CHARACTER GENERATION
These commands are used to cause special characters to appear in the
output.  They are somewhat redundant.  They mostly provide alternates for
the regular DO commands without using obscure characters themselves.

\CR.		Return (same as ↔)
\LF.		Line (same as ↓)
\ALT.		Alt (same as ≠)
\TAB.		Tab
\VT.		Vertical tab
\FF.		Form
\BS.		Backspace

\C.		Add control bit to following character (same as α and VT)
\M.		Add meta bit to following character (same as β and FORM)
\CM.		Add both control and meta bits to following character

\"<char>	Quotes <char> (like ≡)
		THIS COMMAND WILL NOT QUOTE A VERTICAL BAR CHARACTER

\'<octal>	Generate character with given <octal> code number
\=<decimal>	Generate character with given <decimal> code number
		(In rare cases the user may need to delimit the numbers with \.)

\↑<char>	Generate uparrow style character (eg \↑G gets π)
\?<char>	Generate SOS style character (eg \?G gets lower case g)


SYSTEM CHARACTER GENERATION

\CALL.		Generates a deferred call (same as λ)
\ESC.		Preceeds an ESC or BREAK command (same as ⊗)
		Note: WAITS restricts which escape commands are allowed.
		      Also, they are done when scanned and not passed on.
\CLEAR.		Clears the input buffer (with a CLRBUF UUO).


ACTIVATION TABLE MANIPULATION
These commands alter your activation table with the SETACT UUO.  This is
mostly useful for bypassing the line editor for programs (eg RAID) which
use lots of control characters which are also line editor commands.

\NOLINED.	Suppresses the line editor (sets the ALLACT bit)
\LINED.		Unsuppresses the line editor (clears the ALLACT bit)
\NOCONBLT.	Suppresses control B, L and T only (sets the SUPCT bit)
\CONBLT.	Unsuppresses control B, L and T only (clears the SUPCT bit)


BRICK CHARACTER MANIPULATION
Actually, ?\<char> pushes the old brick on a stack.  Hence:

\POPBRICK.	Pops the old brick off the stack and makes it the brick


PRINTING

\PRINT.<char><string-sans-char><char>

This command provides a limited printing capability.  It cannot print
characters such as RETURN normally since these are removed from the input
earlier in the scan.

\NEWLINE.	Prints a CR followed by an LF.


MACRO VARIABLE COMMANDS
There is a set of 128 string variables, whose names are the corresponding
character.  In normal mode scanning these are set with the ?<char>
command.  The following commands allow a limited ammount of manipulation
of these strings.  The symbol <macro> will stand for the character which
is the name of the macro variable.

\←<macro><char><string-sans-char><char>		Sets <macro> to delimited string
\INPUT.<macro>					Inputs <macro> from the terminal
\&<macro1><macro2><macro3>			Like SAIL macro1 ← macro2 & macro3

\INSERT.<macro>		Patches <macro> directly into the output, unlike
			the ?<macro> command which causes it to be rescanned

\PUSHOUT.<macro>	Causes subsequent output to be appended to <macro>
\POPOUT.		Returns to previous output destination


SYNTACTIC COMMANDS

\.					Nothing.  (Can be used to delimit numbers)
\;<char><string-sans-char><char>	Comment, ignores between <char>s


MISCELLANEOUS COMMANDS

\BEEP.		Does a BEEP UUO.
\XYZZY.		Magic.


EXAMPLES OF EXTENDED DO

\;;	This is a typical comment, delimited by semicolons;

\;;	The following generates a string of six equivelance signs (≡'s);
≡≡\"≡\'36\=30\↑↑\?7

\;;	Here we push the brick to get a filehack;
?\$ET \MAIL$POPBRICK.

\;;	This would allow the user to (say) put downarrows around the
	file name without having them turned into LFs by DO;
\PRINT."Filename, please: "\INPUT.F\INSERT.F

\;;	The following uses macro output to reprint its input before DOing it;
\NEWLINE.\PRINT."Type something for me to DO: "\;;	prompt user;
\INPUT.A\;;						get do string;
\PUSHOUT.B\;;						start output to B;
\"\NEWLINE.\"\PRINT.*OK, I will DO \;;	set B to start of a print command;
\INSERT.A*\"\NEWLINE.\;;		insert A, finish print command;
\POPOUT.\;;						return to normal output;
?B\;;							do print command;
?A\;;							do input thing;